package com.zhouxiaoge.ST;

import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupString;

import java.util.LinkedList;
import java.util.List;

public class _Main {
    public static void main(String[] args) {
        String template = "array(values) ::= <<\n" +
                "int[] a = { <values; wrap=\"---\", anchor, separator=\",\"> };\n" +
                ">>";
        STGroup stGroup = new STGroupString(template);
        ST sqlTemplate = stGroup.getInstanceOf("array");
        List<String> list = new LinkedList<>();

        list.add("1");
        list.add("2");
        list.add("3");
        list.add("4");
        sqlTemplate.add("values", list);
        String render = sqlTemplate.render();
        System.out.println(render);

    }
}
